package com.dingwen.stusprbooes.service;

import com.dingwen.stusprbooes.entity.GoodsEntity;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexResponse;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * goods service
 * @author  dingwen
 * 2021/6/27 21:42
 **/

public interface GoodsService {

    /**
     * 保存
     *
     * @param goodsEntity 商品实体
     * @return {@link IndexResponse}
     * @throws IOException io exception
     */
    IndexResponse save(GoodsEntity goodsEntity) throws IOException;


    /**
     * 保存
     *
     * @return {@link BulkResponse}
     * @throws IOException io exception
     */
    BulkResponse save() throws IOException;


    /**
     * 删除通过id
     *
     * @param id id
     * @return {@link DeleteResponse}
     * @throws IOException io exception
     */
    DeleteResponse removeById(String id) throws IOException;

    /**
     * 搜索页面突出
     *
     * @param keywords 关键字
     * @param pageNo   页面没有
     * @param pageSize 页面大小
     * @return {@link List}
     * @throws IOException io exception
     */
    List<Map<String, Object>> searchPageForHighlight(String keywords, int pageNo, int pageSize) throws IOException;
}
